package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.example.entity.system.Permission;

import java.util.List;
import java.util.Map;

/**
 * @author 魏锴
 * @description 针对表【tb_sys_perm】的数据库操作Mapper
 * @createDate 2024-01-11 15:16:46
 * @Entity org.example.entity.Permisson
 */
public interface PermissionMapper extends BaseMapper<Permission> {
    boolean insertPermission(Permission permission);

    boolean updatePermission(Permission permission);

    boolean deletePermission(int id);

    List<Permission> getPermissionList();

    List<Integer> getPermsByRoles(@Param("roles") List<Integer> roles);

    List<Permission> getPermOpsByRoleId(int role_id);
    @MapKey("id")
    List<Map<String, Object>> getPermissionIdMap();
    boolean grantPermission(@Param("role_id") int role_id,@Param("perm_id") int perm_id);
    boolean revokePermission(@Param("role_id") int role_id,@Param("perm_id") int perm_id);
}




